<%@tag import="org.apache.shiro.util.StringUtils" %>
<%@tag import="org.apache.shiro.SecurityUtils" %>
<%@tag import="java.util.Arrays" %>
<%@page trimDirectiveWhitespaces="true"%>.
<%@attribute name="name" type="java.lang.String" required="true" description="角色列表" %>
<%@attribute name="delimiter" type="java.lang.String" required="false" description="角色列表分割符" %>
<%
    if (!StringUtils.hasText(delimiter)){
        delimiter=",";  //默认逗号分隔
    }

    if(!StringUtils.hasText(name)){
%>
    <jsp:doBody />
<%
    return ;
    }

    String[] roles =name.split(delimiter);
    if (!SecurityUtils.getSubject().hasAllRoles(Arrays.asList(roles))){
        return ;
    }else{
%>
    <jsp:doBody />
<%
    }
%>